package com.neusoft.bizcore.activiti.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "wf_process_form_item")
@org.hibernate.annotations.Table(appliesTo = "wf_process_form_item", comment = "流程表单字段表")
public class ProcessFormItem extends AbstractModel {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "表单字段名不能为空")
    @Length(max = 255, message = "表单字段名不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '表单字段名称'")
    private String name;

    @NotBlank(message = "表单字段KEY不能为空")
    @Length(max = 255, message = "表单字段KEY不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '编码'")
    private String nodeKey;

    @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST }, fetch = FetchType.LAZY)
    ProcessForm form;
}
